

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>块设备与 CloudStack &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="Ceph iSCSI Gateway" href="../iscsi-overview/" />
    <link rel="prev" title="块设备与 OpenStack" href="../rbd-openstack/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 块设备</a> &raquo;</li>
        
          <li><a href="../rbd-integrations/">Ceph 块设备与第三方对接</a> &raquo;</li>
        
      <li>块设备与 CloudStack</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/rbd/rbd-cloudstack.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 块设备</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../rados-rbd-cmds/">基本命令</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rbd-operations/">运维</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../rbd-integrations/">对接</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../rbd-ko/">内核模块</a></li>
<li class="toctree-l3"><a class="reference internal" href="../qemu-rbd/">QEMU</a></li>
<li class="toctree-l3"><a class="reference internal" href="../libvirt/">libvirt</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-kubernetes/">Kubernetes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-nomad/">Nomad</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-openstack/">OpenStack</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">CloudStack</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#index-0">创建存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph">创建 Ceph 用户</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">添加主存储</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3">创建存储服务</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">局限性</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../iscsi-overview/">LIO iSCSI Gateway</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-windows/">Windows</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../man/">手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="cloudstack">
<h1>块设备与 CloudStack<a class="headerlink" href="#cloudstack" title="Permalink to this headline">¶</a></h1>
<p>CloudStack 4.0 及以上版本可以通过 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> 使用 Ceph 块设备， <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> 会配置 QEMU 与 <code class="docutils literal notranslate"><span class="pre">librbd</span></code> 交互。 Ceph 会把块设备映像条带化为对象并分布到整个集群，这意味着大个的 Ceph
块设备性能会优于单体服务器。</p>
<p>要让 CloudStack 4.0 及更高版使用 Ceph 块设备，你得先安装
QEMU 、 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> 、和 CloudStack 。我们建议在另外一台物理服务器上安装 CloudStack ，此软件最低需要 4GB 内存和一个双核
CPU ，但是资源越多越好。下图描述了 CloudStack/Ceph 技术栈。</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>要让 CloudStack 使用 Ceph 块设备，你必须有
Ceph 存储集群的访问权限。</p>
</div>
<p>CloudStack 集成了 Ceph 的块设备作为它的主要存储（ Primary
Storage ），下列指令详述了 CloudStack 的安装。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>我们建议您安装 Ubuntu 14.04 或更高版本，这样就不用手动编译 libvirt 了。</p>
</div>
<p>安装、配置 QEMU 用于 CloudStack 不需要任何特殊处理。确保你的
Ceph 存储集群在运行，配置好 QEMU 即可；然后安装 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code>
0.9.13 或更高版本（也许得手动编译）并确保它与 Ceph 磨合正常。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Ubuntu 14.04 和 CentOS 7.2 版搭载了 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> ，
而且默认启用了 RBD 存储池支持。</p>
</div>
<div class="section" id="index-0">
<span id="id1"></span><h2>创建存储池<a class="headerlink" href="#index-0" title="Permalink to this headline">¶</a></h2>
<p>默认情况下， Ceph 块设备使用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 存储池，建议为 CloudStack
NFS 主存储新建一存储池。确保 Ceph 集群在运行，再创建存储池：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">pool</span> <span class="n">create</span> <span class="n">cloudstack</span>
</pre></div>
</div>
<p>参考<a class="reference external" href="../../rados/operations/pools#createpool">创建存储池</a>为存储池指定归置组数量，参考<a class="reference external" href="../../rados/operations/placement-groups">归置组</a>确定应该为存储池分配多少归置组。</p>
<p>新建的存储池在使用前必须先初始化，用 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 工具初始化此存储池：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">rbd</span> <span class="n">pool</span> <span class="n">init</span> <span class="n">cloudstack</span>
</pre></div>
</div>
</div>
<div class="section" id="ceph">
<h2>创建 Ceph 用户<a class="headerlink" href="#ceph" title="Permalink to this headline">¶</a></h2>
<p>要访问 Ceph 集群，我们需要一个有足够权限的 Ceph 用户，以便访问我们刚刚创建的 <code class="docutils literal notranslate"><span class="pre">cloudstack</span></code> 存储池。虽说我们可以用 <code class="docutils literal notranslate"><span class="pre">client.admin</span></code> ，
还是建议新建一个只能访问 <code class="docutils literal notranslate"><span class="pre">cloudstack</span></code> 存储池的用户。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">auth</span> <span class="n">get</span><span class="o">-</span><span class="ow">or</span><span class="o">-</span><span class="n">create</span> <span class="n">client</span><span class="o">.</span><span class="n">cloudstack</span> <span class="n">mon</span> <span class="s1">&#39;profile rbd&#39;</span> <span class="n">osd</span> <span class="s1">&#39;profile rbd pool=cloudstack&#39;</span>
</pre></div>
</div>
<p>下一步，添加主存储（ Primary Storage ）时，我们需要用这个命令返回的信息。</p>
<p>详情见 <a class="reference external" href="../../rados/operations/user-management">用户管理</a> 。</p>
</div>
<div class="section" id="id2">
<h2>添加主存储<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p>要添加一个 Ceph 块设备作为 Primary Storage ，步骤包括：</p>
<ol class="arabic simple">
<li><p>登录 CloudStack 界面；</p></li>
<li><p>点击左侧导航条的 <strong>Infrastructure</strong> ；</p></li>
<li><p>选择 <strong>Primary Storage</strong> 下的 <strong>View All</strong> ；</p></li>
<li><p>点击右上角的 <strong>Add Primary Storage</strong> 按钮；</p></li>
<li><p>按照你的基础设施配置，填入下列信息：</p>
<ul class="simple">
<li><p>Scope （就是说，集群或 zone 范围的）</p></li>
<li><p>Zone.</p></li>
<li><p>Pod.</p></li>
<li><p>Cluster.</p></li>
<li><p>主存储的名字。</p></li>
<li><p><strong>Protocol</strong> 那里选择 <code class="docutils literal notranslate"><span class="pre">RBD</span></code> ；</p></li>
<li><p><strong>Provider</strong> ，这里选择适宜你的供应商类型（即 DefaultPrimary, SolidFire,
SolidFireShared, 或 CloudByte）。根据选定的供应商，填上对应的相关信息。</p></li>
</ul>
</li>
<li><p>添加集群信息（支持 <code class="docutils literal notranslate"><span class="pre">cephx</span></code> ）。</p>
<ul class="simple">
<li><p><strong>RADOS Monitor</strong> 这里填入一个 Ceph 监视器节点的 IP 地址。</p></li>
<li><p><strong>RADOS Pool</strong> 这里填入一个 RBD 存储池的名字。</p></li>
<li><p><strong>RADOS User</strong> 这里填入用户，这个用户应该有此存储池的足够的权限。注：不要加用户名的 <code class="docutils literal notranslate"><span class="pre">client.</span></code> 部分；</p></li>
<li><p><strong>RADOS Secret</strong> 这里填入用户的密钥；</p></li>
<li><p><strong>Storage Tags</strong> 是可选的。用不用标签由你，关于 CloudStack
的存储标签，请参考<a class="reference external" href="http://docs.cloudstack.apache.org/en/latest/adminguide/storage.html#storage-tags">存储标签</a> 。</p></li>
</ul>
</li>
<li><p>点击 <strong>OK</strong> 。</p></li>
</ol>
</div>
<div class="section" id="id3">
<h2>创建存储服务<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<p>要新建硬盘存储服务，参考<a class="reference external" href="http://docs.cloudstack.apache.org/en/latest/adminguide/service_offerings.html#creating-a-new-disk-offering">创建一个新磁盘服务服务</a>。 创建一存储服务以与 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 标签相配，这样 <code class="docutils literal notranslate"><span class="pre">StoragePoolAllocator</span></code>
查找合适存储池时就会选择 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 存储池；如果磁盘服务没有与
<code class="docutils literal notranslate"><span class="pre">rbd</span></code> 标签相配， <code class="docutils literal notranslate"><span class="pre">StoragePoolAllocator</span></code> 就会选用你创建的存储池（即 <code class="docutils literal notranslate"><span class="pre">clouldstack</span></code> ）。</p>
</div>
<div class="section" id="id4">
<h2>局限性<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p>ClouldStack 只能绑定一个监视器（但你可以创建一个轮询域名来滚动多个监视器）</p></li>
</ul>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../iscsi-overview/" class="btn btn-neutral float-right" title="Ceph iSCSI Gateway" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../rbd-openstack/" class="btn btn-neutral float-left" title="块设备与 OpenStack" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>